package com.word.app.controller.response;

import java.util.*;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.word.app.pojo.Close;
import com.word.app.service.impl.CloseServiceImpl;

@RestController
public class CloseController {

    @Autowired
    CloseServiceImpl service = new CloseServiceImpl();

    @RequiresPermissions(value={"perm:root", "perm:visitor"}, logical = Logical.OR)
    @GetMapping("close/all")
    public List<Map<String, Object>> getAllNameList(){
        QueryWrapper warpper = new QueryWrapper<>();
		String[] columns = {"name", "id"};
		warpper.select(columns);
        return service.listMaps(warpper);
    }

    @RequiresPermissions(value={"perm:root", "perm:visitor"}, logical = Logical.OR)
    @GetMapping("close")
    public Close getClose(@RequestParam("id")String id){
        return service.getById(id);
    }
}
